package tools;

public class BonusAttribut {

	private String carac;
	private int value;
	
	public BonusAttribut(String stat)
	{
		String[] decoupage =	stat.split(" ");
		this.carac=decoupage[0].toLowerCase();
		if(decoupage[1].charAt(decoupage[1].length()-1)=='%')
		{
			decoupage[1]=decoupage[1].substring(0, decoupage[1].length()-1);
		}
		this.value=new Integer(decoupage[1]);
	}
	
	
	public BonusAttribut(String name, int val)
	{
		//to do name parser P_EQUIP_SWORD_G1 --> SWORD
		this.carac=name.toLowerCase();
		this.value=val;
	}

	public void setCarac(String carac) {
		this.carac = carac.toLowerCase();
	}

	public String getCarac() {
		return carac;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}
	
	public String toString()
	{
		return "Attribut : "+this.carac+" increased by "+this.value;
	}
}
